package com.mega.ebcs.integration.route;

import java.io.UnsupportedEncodingException;
import java.util.Properties;

import org.apache.camel.builder.RouteBuilder;

import com.mega.ebcs.integration.processor.ClientToHostProcessor;

public class ClientToHostRoute extends RouteBuilder{
	private Properties prop;
	
	public void setProp(Properties prop) {
		this.prop = prop;
	}
	
	public ClientToHostRoute() {	
	}
	public ClientToHostRoute(Properties prop) {
		this.prop = prop;
	}
	@Override
	public void configure() throws Exception {
		onException(UnsupportedEncodingException.class)
		.handled(true)
		.setBody(constant("Unsupported Format"));		
		//from("netty:tcp://10.11.33.145:212?sync=true&textline=true&disconnect=true&maximumPoolSize=200")
		from(prop.getProperty("netty.url.request")).to("log:org.apache.camel.ClientToHostRoute")
		.process(new ClientToHostProcessor())		
		.to(prop.getProperty("jt400.url.request"))
		.to("direct:processOrder");
		//.to("seda:outbox?timeout=50000&concurrentConsumers=100");
		
			
	}

}
